https://retellai.com/?utm_source=discord&utm_medium=seo logo
Why would i build multiple agents that handoff to ...
# ❓・ai-evy-support
r
@AI Evy Why would i build multiple agents that handoff to each other if agent's lost context or completely what is happening in the conversation
a
Thanks for tagging me @renovia_70920. I'll look through relevant sources and get back to you shortly.
### Answer Actually, with Retell AI's Agent Transfer feature, agents don't lose context when transferring to each other—that's one of the key advantages. [(1) ]() [(2) ]() Why Agent Transfer maintains context: The destination agent has access to the full conversation history , which eliminates the need for handoff messages or repeated customer questions . This is a major benefit compared to traditional call transfers. Why you'd still build multiple specialized agents: [(1) ]() [(2) ]() [(3) ]() - **Task modularization**: Transfer from a front-desk agent to an appointment-booking agent based on specific tasks [(1) ]() [(2) ]() - **Language switching**: Transfer from an agent speaking one language to another handling a different language based on user preference - **Specialized expertise**: Each agent can have focused prompts and tools for their specific domain [(3) ]() - **Re-usability**: You can use specialized agents across different workflows without duplicating configuration [(1) ]() [(2) ]() Additional advantages over call transfer: - **Lower latency**: Near-instant transitions - **Better reliability**: No new phone call creation, avoi
ding telephony failures - **No separate numbers needed**: One number handles all agents The conversation history preservation means the second agent knows everything that happened before the transfer, so there's no context loss.
​ To learn more, see the sources I considered: [[1] Agent Transfer](https://docs.retellai.com/build/single-multi-prompt/transfer-agent) [[2] Agent Transfer Node](https://docs.retellai.com/build/conversation-flow/transfer-agent-node) [[3] How An AI Agent Knows When to do Handoffs | Retell AI](https://www.retellai.com/blog/how-an-ai-agent-knows-when-to-handoff-to-a-human-agent) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
r
@AI Evy This call will be recorded for quality and training purposes Node Transition Knowledge Base Retrieval Thank you for calling Renova Energy. My name is Renovia, and I'm an AI assistant here to help direct your call. To assist you properly, could you briefly describe what you’re calling about today? i'd like to schedule a cleaning Node Transition Node Transition Tool Invocation: extract_dynamic_variables Tool Result Node Transition Tool Invocation: agent_swap Tool Result Node Transition Knowledge Base Retrieval Hi there, you’ve reached RenovaPLUS, Renova’s solar maintenance team—happy to help with that cleaning. 😊 May I ask who I’m speaking with? Debug Read this transcript. The second agent repeated the greeting after the handoff
a
Thanks for the follow-up, @renovia_70920. I'll get back to you soon.
​ To learn more, see the sources I considered: [[1] Agent Transfer Node](https://docs.retellai.com/build/conversation-flow/transfer-agent-node) [[2] Agent Transfer](https://docs.retellai.com/build/single-multi-prompt/transfer-agent) ​
### Answer The second agent introducing itself with a greeting after the transfer is expected behavior. The destination agent has access to the full conversation history [(1) ]() [(2) ]() , but it still executes its own first message/greeting as configured in that agent's settings. To prevent the repeated greeting: Configure the second agent's first message to acknowledge the transfer context rather than starting fresh. For example, instead of "Hi there, you've reached RenovaPLUS..." you could set the first message to something like "Great, I can help with that cleaning request" or even leave the first message empty if you want the agent to continue seamlessly from where the first agent left off. The transferred agent inherits the conversation history but doesn't automatically skip its configured opening—you need to adjust that agent's first message setting to match your desired handoff experience .
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
r
@AI Evy but the second agent can be reached directly. How will it be able to handle without the initial greeting?
a
Thanks for the follow-up, @renovia_70920. I'll get back to you soon.
### Answer You raise an excellent point. The available sources don't provide specific guidance on how to handle this dual-use scenario where the same agent needs both a greeting for direct calls and no greeting for transfers. Based on what's documented, you have a few architectural options: Option 1: Use dynamic variables to conditionally control the first message Since the agent has access to the full conversation history when transferred [(1) ]() [(2) ]() , you could potentially use dynamic variables or context to detect whether this is a transfer scenario versus a direct call, though the sources don't explicitly document this pattern. Option 2: Create separate agent versions Maintain two versions of the same agent—one configured with a greeting for direct access, and another without a greeting specifically for transfers. This ensures each entry point has the appropriate behavior. Option 3: Handle the greeting in the prompt/logic Configure the agent's prompt to check the conversation history and adjust its behavior accordingly, though this adds complexity. I don't have explicit documentation on the recommended approach for this specific use case. For the most reliable solution, I'd recommend reaching out to Retell AI support or checking their community forums for best practices on handling agents that serve both as transfer destinations and direct entry points. Would you like me to provide a general answer based on common patterns in conversational AI systems?
​ To learn more, see the sources I considered: [[1] Agent Transfer Node](https://docs.retellai.com/build/conversation-flow/transfer-agent-node) [[2] Agent Transfer](https://docs.retellai.com/build/single-multi-prompt/transfer-agent) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
Thanks for the follow-up, @renovia_70920. I'll get back to you soon.
r
@AI Evy Can dynamic variables pass down to two agents?
a
### Answer --- Yes, dynamic variables can be passed between agents during transfers. Dynamic variables set at the call level are accessible throughout the entire call, including after agent transfers [(1) ]() . You can set dynamic variables when creating the call via the
retell_llm_dynamic_variables
field , and you can also update them mid-call using the Update Call API's
override_dynamic_variables
parameter [(2) ]() . Additionally, agents can extract and store dynamic variables in real-time during conversations using the Extract Dynamic Variables tool [(3) ]() [(4) ]() . These extracted variables become part of the call's dynamic variables and are accessible to subsequent agents in the transfer chain [(4) ]() . How it works: - Dynamic variables are call-scoped, not agent-scoped [(1) ]() - When you transfer from Agent A to Agent B, Agent B has access to all dynamic variables set during the call - Variables extracted by Agent A using the Extract Dynamic Variables tool are available to Agent B [(3) ]() [(4) ]() This means if your first agent (Renovia) extracts customer information like name or service type, your second agent (RenovaPLUS) can reference those same variables using the
{{variable_name}}
syntax in its prompts or tool configurations [(1) ]() .
​ To learn more, see the sources I considered: [[1] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[2] Update Call](https://docs.retellai.com/api-references/update-call) [[3] Extract Dynamic Variables](https://docs.retellai.com/build/single-multi-prompt/extract-dv) [[4] Platform Changelogs | Retell AI](https://www.retellai.com/changelog) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
r
@AI Evy how come some dynamic variables that captured earlier in the call via the incoming webhook are not pass down. There agent two handoffs happening Agent 1 > Agent 2 > Agent 3
a
Thanks for the follow-up, @renovia_70920. I'll get back to you soon.
### Answer --- ### Answer Based on the documentation, dynamic variables set via the inbound webhook should persist across all agent transfers in your Agent 1 → Agent 2 → Agent 3 chain [(1) ]() [(2) ]() . However, there are a few potential reasons why some variables might not be passing through: 1. Webhook Response Format When you set dynamic variables in your inbound webhook response, ensure you're using the correct field structure [(2) ]() :
Copy code
json
{
  "retell_llm_dynamic_variables": {
    "variable_name": "value"
  }
}
All values must be strings [(1) ]() . 2. Variable Overwriting If any agent in the chain uses the Extract Dynamic Variables tool or the Update Call API with
override_dynamic_variables
, it could be overwriting or clearing previously set variables . The
override_dynamic_variables
parameter replaces existing variables rather than merging them . 3. Agent-Level Default Variables If Agent 2 or Agent 3 has agent-level default dynamic variables configured, these defaults only apply when specific variables aren't included in the call request . However, they shouldn't override variables already set at the call level. Troubleshooting Steps: 1. Verify your inbound webhook is returning the variables in the
retell_llm_dynamic_variables
field [(2) ]() 2. Check if any agent in the chain is calling Extract Dynamic Variables or Update Call API that might be overwriting the original variables [(1) ]() 3. Ensure all variable values are strings, not other data types 4. Test with a simple variable to isolate whether the issue is with specific variables or all variables Dynamic variables are call-scoped, not agent-scoped, so they should persist throughout the entire call lifecycle including multiple agent transfers . If the issue persists after checking these points, I'd recommend contacting Retell AI support with specific call IDs showing the variable loss, as this may indicate a platform issue with webhook-originated variables not properly persisting through multiple transfers. --- **
​ To learn more, see the sources I considered: [[1] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[2] Inbound webhook](https://docs.retellai.com/features/inbound-call-webhook) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
r
Do i have to declare these variables in the global prompt for using them as a parameter in a function?
@AI EvyDo i have to declare these variables in the global prompt for using them as a parameter in a function?
a
Thanks for the follow-up, @renovia_70920. I'll get back to you soon.
### Answer ### Answer No, you don't need to declare dynamic variables in the global prompt to use them as function parameters [(1) ]() . How to use dynamic variables in function parameters: You can reference dynamic variables directly in your function configurations using the
{{variable_name}}
syntax . Dynamic variables work in: - Custom function URLs - Tool descriptions - Property descriptions Example usage in function parameters: Based on community discussions, when using dynamic variables in function query parameters or descriptions, you should format them as
{{variable_name}}
[(2) ]() [(3) ]() . For instance, if you have a
customer_id
dynamic variable, you can use it directly in a function parameter like
{{customer_id}}
[(3) ]() . Important note from the community: If you're extracting variables from API responses and need to access nested properties, use the correct path notation. For example, if you have a response stored in a variable called
locations
, access the first item's ID as
{{data.locations[0].id}}
rather than
{{locations[0].id}}
[(2) ]() . The dynamic variables are call-scoped and accessible throughout the entire call, including in all function calls, without needing explicit declaration in prompts [(1) ]() . ---
​ To learn more, see the sources I considered: [[1] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[2] dynamic variables in function query parameters are not parsed](https://discord.com/channels/1186424376300679209/1414306451656151291) [[3] Dynamic Variable is not sending via custom function.](https://discord.com/channels/1186424376300679209/1430715756030722149) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
r
@AI Evy how to use caller's phone number in function parameter
a
Thanks for the follow-up, @renovia_70920. I'll get back to you soon.
### Answer ### Answer You can use the caller's phone number in function parameters by referencing the built-in system variable
{{user_number}}
[(1) ]() . How to use it: In your custom function configuration, you can include
{{user_number}}
directly in: - Query parameters [(2) ]() - Request headers - Custom function URLs [(1) ]() What
{{user_number}}
contains:
For phone calls,
{{user_number}}
represents the user's phone number : - For **inbound calls**: it's the
from_number
- For **outbound calls**: it's the
to_number
Example usage: If you're setting up a custom function with query parameters, you can add a parameter like: - Parameter name:
phone
- Parameter value:
{{user_number}}
This will automatically populate with the caller's phone number when the function is invoked [(2) ]() [(1) ]() . Additional phone-related variables: You also have access to: -
{{agent_number}}
- The agent's phone number (to_number for inbound, from_number for outbound) [(1) ]() -
{{from_number}}
and
{{to_number}}
if you need more specific control These system variables are automatically available throughout the entire call and don't need to be declared or set manually .
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
​ To learn more, see the sources I considered: [[1] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[2] Custom Function](https://docs.retellai.com/build/conversation-flow/custom-function) ​
r
@AI Evy how come call kept ringing when caller called in
a
Thanks for the follow-up, @renovia_70920. I'll get back to you soon.
### Answer ### Answer When inbound calls keep ringing without being answered, there are several common causes based on community reports: 1. Agent Configuration Issues Ensure your phone number has the correct
inbound_agent_id
assigned [(1) ]() . Verify that: - The agent ID is correct - Agent settings are properly configured - The agent is published and active 2. Ring Duration Settings By default, phone ringing lasts 30,000 ms (30 seconds) [(2) ]() [(3) ]() . If you need longer ring times, you can adjust the
ring_duration_ms
parameter when creating or updating your agent :
Copy code
json
{
  "ring_duration_ms": 30000
}
[(2) ]() , [(3) ]() Valid range is [5,000, 90,000] milliseconds [(2) ]() [(3) ]() . 3. Temporary Platform Issues Community members have reported that sometimes calls keep ringing due to temporary Retell platform issues [(1) ]() . In some cases, the solution was to modify the agent number assignment and then revert it back to the original value . 4. Phone Number Not Properly Configured If using Twilio or another provider, ensure the number is correctly set up [(4) ]() . The phone number must be purchased and configured through Retell AI or properly imported from a supported provider [(5) ]() . Troubleshooting Steps: 1. Verify the
inbound_agent_id
is correctly assigned to your phone number [(1) ]() 2. Check that your agent is published and active 3. Test with another agent to isolate whether it's an agent-specific issue 4. Try reassigning the phone number (remove and re-add the agent) 5. Check for any call restrictions in your account settings If the issue persists after these checks, it may be a temporary platform issue that resolves itself . ---
​ To learn more, see the sources I considered: [[1] Calls just keeps ringing- Phone number is assigned to an Agent](https://discord.com/channels/1186424376300679209/1349824627643252736) [[2] Create Agent](https://docs.retellai.com/api-references/create-agent) [[3] Update Agent](https://docs.retellai.com/api-references/update-agent) [[4] Discord message from @gyutaeq_71417 on 2024-12-31](https://discord.com/channels/1186424376300679209/1294891368505937952/1323667569688707087) [[5] 404 Error on Create a Phone Call](https://retell.discourse.group/t/404-error-on-create-a-phone-call/22) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.